package com.cskaoyan.service;

import com.cskaoyan.bean.BO.BasePageInfoBo;
import com.cskaoyan.bean.PO.MarketUser;
import com.cskaoyan.bean.VO.WxFootPrintVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.mapper.MarketGoodsMapper;
import com.cskaoyan.mapper.WxFootPrintMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author linhanxin
 * @date 2022/8/17.
 */
@Service
public class WxFootPrintServiceImpl implements WxFootPrintService {

    @Autowired
    WxFootPrintMapper wxFootPrintMapper;

    @Autowired
    MarketGoodsMapper marketGoodsMapper;

    @Override
    public CommonData<WxFootPrintVo> footPrintList(BasePageInfoBo basePageInfoBo,Integer id) {

        PageHelper.startPage(basePageInfoBo.getPage(), basePageInfoBo.getLimit());

        List<WxFootPrintVo> wxFootPrintVoList = wxFootPrintMapper.selectFootprintByUserId(id);

        PageInfo<WxFootPrintVo> pageInfo = new PageInfo<>(wxFootPrintVoList);

        return CommonData.data(pageInfo);
    }

    @Override
    public void deleteFootPrint(Integer id) {
        wxFootPrintMapper.deleteFootPrintById(id);
    }
}
